package com.clz.latte.app;

import android.content.Context;
import android.os.Handler;

/**
 * Created by clz on 2017/11/8.
 */

public final class Latte {
    public static ConfigUrator init(Context context) {
        getConfigUrator()
                .getLatteConfigs()
                .put(ConfigKeys.APPLICATION_CONTEXT.name(), context.getApplicationContext());
        return ConfigUrator.getInstance();
    }

    public static ConfigUrator getConfigUrator() {
        return ConfigUrator.getInstance();
    }

    public static <T> T getConfiguration(Object key) {
        return getConfigUrator().getConfiguration(key);
    }

    public static Context getAppplication() {
        Context context = getConfiguration(ConfigKeys.APPLICATION_CONTEXT.name());
        return context;
    }
    public static Handler getHandler() {
        return getConfiguration(ConfigKeys.HANDLER);
    }
}
